<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Kinetis Bootloader: CRC driver</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="nxp_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Kinetis Bootloader
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
   <div id="projectbrief">Common bootloader for Kinetis devices</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Introduction</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__crc__driver.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">CRC driver<div class="ingroups"><a class="el" href="group__crc.html">CRC</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-0-trigger" src="closed.png" alt="+"/> Collaboration diagram for CRC driver:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<center><table><tr><td><div class="center"><iframe scrolling="no" frameborder="0" src="group__crc__driver.svg" width="191" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
</div>
</td></tr></table></center>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structcrc__config__t"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a></td></tr>
<tr class="memdesc:structcrc__config__t"><td class="mdescLeft">&#160;</td><td class="mdescRight">CRC protocol configuration.  <a href="group__crc__driver.html#structcrc__config__t">More...</a><br /></td></tr>
<tr class="separator:structcrc__config__t"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga27bb6a5dfedbecde067e8312600acc48"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crc__driver.html#ga27bb6a5dfedbecde067e8312600acc48">crc_bits_t</a> { <br />
&#160;&#160;<b>kCrcBits16</b> = 0U, 
<br />
&#160;&#160;<a class="el" href="group__crc__driver.html#gga27bb6a5dfedbecde067e8312600acc48ae8b84560a29f3070992ffde7d45eabeb">kCrcBits32</a> = 1U
<br />
 }<tr class="memdesc:ga27bb6a5dfedbecde067e8312600acc48"><td class="mdescLeft">&#160;</td><td class="mdescRight">CRC bit width.  <a href="group__crc__driver.html#ga27bb6a5dfedbecde067e8312600acc48">More...</a><br /></td></tr>
</td></tr>
<tr class="separator:ga27bb6a5dfedbecde067e8312600acc48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab245947cd140d75c90d2e185f3ae22f5"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crc__driver.html#gab245947cd140d75c90d2e185f3ae22f5">crc_result_t</a> { <br />
&#160;&#160;<b>kCrcFinalChecksum</b> = 0U, 
<br />
&#160;&#160;<a class="el" href="group__crc__driver.html#ggab245947cd140d75c90d2e185f3ae22f5ad008037099aa6038d87976c8c29bf489">kCrcIntermediateChecksum</a> = 1U
<br />
 }<tr class="memdesc:gab245947cd140d75c90d2e185f3ae22f5"><td class="mdescLeft">&#160;</td><td class="mdescRight">CRC result type.  <a href="group__crc__driver.html#gab245947cd140d75c90d2e185f3ae22f5">More...</a><br /></td></tr>
</td></tr>
<tr class="separator:gab245947cd140d75c90d2e185f3ae22f5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga7114311534a33b6688f35ceaaa3f7832"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832">CRC_Init</a> (CRC_Type *base, const <a class="el" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a> *config)</td></tr>
<tr class="memdesc:ga7114311534a33b6688f35ceaaa3f7832"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable and configure the CRC peripheral module.  <a href="#ga7114311534a33b6688f35ceaaa3f7832">More...</a><br /></td></tr>
<tr class="separator:ga7114311534a33b6688f35ceaaa3f7832"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7a4d725b011a98efb29a26bcca04c35b"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crc__driver.html#ga7a4d725b011a98efb29a26bcca04c35b">CRC_Deinit</a> (CRC_Type *base)</td></tr>
<tr class="memdesc:ga7a4d725b011a98efb29a26bcca04c35b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable the CRC peripheral module.  <a href="#ga7a4d725b011a98efb29a26bcca04c35b">More...</a><br /></td></tr>
<tr class="separator:ga7a4d725b011a98efb29a26bcca04c35b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab681cd7c82fbafd927d6b22f23a81804"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crc__driver.html#gab681cd7c82fbafd927d6b22f23a81804">CRC_GetDefaultConfig</a> (<a class="el" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a> *config)</td></tr>
<tr class="memdesc:gab681cd7c82fbafd927d6b22f23a81804"><td class="mdescLeft">&#160;</td><td class="mdescRight">Loads default values to CRC protocol configuration structure.  <a href="#gab681cd7c82fbafd927d6b22f23a81804">More...</a><br /></td></tr>
<tr class="separator:gab681cd7c82fbafd927d6b22f23a81804"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga33f99b0cb581e677dbc009a695adf5d5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a> (CRC_Type *base, const uint8_t *data, size_t dataSize)</td></tr>
<tr class="memdesc:ga33f99b0cb581e677dbc009a695adf5d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write data to the CRC module.  <a href="#ga33f99b0cb581e677dbc009a695adf5d5">More...</a><br /></td></tr>
<tr class="separator:ga33f99b0cb581e677dbc009a695adf5d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0c8ce306124e645b27798fad68f3ac4f"><td class="memItemLeft" align="right" valign="top">static uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f">CRC_Get32bitResult</a> (CRC_Type *base)</td></tr>
<tr class="memdesc:ga0c8ce306124e645b27798fad68f3ac4f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read 32-bit checksum from the CRC module.  <a href="#ga0c8ce306124e645b27798fad68f3ac4f">More...</a><br /></td></tr>
<tr class="separator:ga0c8ce306124e645b27798fad68f3ac4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga446972c25252d95d42f573553d32091f"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f">CRC_Get16bitResult</a> (CRC_Type *base)</td></tr>
<tr class="memdesc:ga446972c25252d95d42f573553d32091f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read 16-bit checksum from the CRC module.  <a href="#ga446972c25252d95d42f573553d32091f">More...</a><br /></td></tr>
<tr class="separator:ga446972c25252d95d42f573553d32091f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Usage Information</h2>
<p>This section describes the programming interface of the CRC driver.</p>
<h1><a class="anchor" id="CRCInit"></a>
CRC Driver Initialization and Configuration</h1>
<p><a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832" title="Enable and configure the CRC peripheral module. ">CRC_Init()</a> function enables the clock gate for the CRC module in the Kinetis SIM module and fully (re-)configures the CRC module according to configuration structure. The seed member of the configuration structure is the initial checksum for which new data can be added to. When starting new checksum computation, the seed shall be set to the initial checksum per the CRC protocol specification. For continued checksum operation, the seed shall be set to the intermediate checksum value as obtained from previous calls to <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> or <a class="el" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f" title="Read 32-bit checksum from the CRC module. ">CRC_Get32bitResult()</a> function. After <a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832" title="Enable and configure the CRC peripheral module. ">CRC_Init()</a>, one or multiple <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> calls follow to update checksum with data, then <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> or <a class="el" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f" title="Read 32-bit checksum from the CRC module. ">CRC_Get32bitResult()</a> follows to read the result. The crcResult member of confiration structure determines if <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> or <a class="el" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f" title="Read 32-bit checksum from the CRC module. ">CRC_Get32bitResult()</a> return value is final checksum or intermediate checksum. <a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832" title="Enable and configure the CRC peripheral module. ">CRC_Init()</a> can be called as many times as required, thus, allows for runtime changes of CRC protocol.</p>
<p><a class="el" href="group__crc__driver.html#gab681cd7c82fbafd927d6b22f23a81804" title="Loads default values to CRC protocol configuration structure. ">CRC_GetDefaultConfig()</a> function can be used to set the module configuration structure with parameters for CRC-16/CCIT-FALSE protocol.</p>
<h1><a class="anchor" id="CRCWrite"></a>
CRC Write Data</h1>
<p>The <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> function is used to add data to actual CRC. Internally it tries to use 32-bit reads and writes for all aligned data in the user buffer and it uses 8-bit reads and writes for all unaligned data in the user buffer. This function can update CRC with user supplied data chunks of arbitrary size, so one can update CRC byte by byte or with all bytes at once. Prior call CRC configuration function <a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832" title="Enable and configure the CRC peripheral module. ">CRC_Init()</a> fully specifies the CRC module configuration for <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> call.</p>
<h1><a class="anchor" id="CRCGet"></a>
CRC Get Checksum</h1>
<p>The <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> or <a class="el" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f" title="Read 32-bit checksum from the CRC module. ">CRC_Get32bitResult()</a> function is used to read the CRC module data register. Depending on prior CRC module usage the return value is either intermediate checksum or final checksum. Example: for 16-bit CRCs the following call sequences can be used:</p>
<p><a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832" title="Enable and configure the CRC peripheral module. ">CRC_Init()</a> / <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> / <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> to get final checksum.</p>
<p><a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832" title="Enable and configure the CRC peripheral module. ">CRC_Init()</a> / <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> / ... / <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> / <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> to get final checksum.</p>
<p><a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832" title="Enable and configure the CRC peripheral module. ">CRC_Init()</a> / <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> / <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> to get intermediate checksum.</p>
<p><a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832" title="Enable and configure the CRC peripheral module. ">CRC_Init()</a> / <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> / ... / <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> / <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> to get intermediate checksum.</p>
<h1><a class="anchor" id="CRCRtos"></a>
Comments about API usage in RTOS</h1>
<p>If multiple RTOS tasks will share the CRC module to compute checksums with different data and/or protocols, the following shall be implemented by user:</p>
<p>The triplets</p>
<p><a class="el" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832" title="Enable and configure the CRC peripheral module. ">CRC_Init()</a> / <a class="el" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5" title="Write data to the CRC module. ">CRC_WriteData()</a> / <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> or <a class="el" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f" title="Read 32-bit checksum from the CRC module. ">CRC_Get32bitResult()</a></p>
<p>shall be protected by RTOS mutex to protect CRC module against concurrent accesses from different tasks. Example: </p><div class="fragment"><div class="line">CRC_Module_RTOS_Mutex_Lock;</div><div class="line"><a class="code" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832">CRC_Init</a>();</div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(); </div><div class="line"><a class="code" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f">CRC_Get16bitResult</a>();</div><div class="line">CRC_Module_RTOS_Mutex_Unlock;</div></div><!-- fragment --><h1><a class="anchor" id="CRCisr"></a>
Comments about API usage in interrupt handler</h1>
<p>All APIs can be used from interrupt handler although execution time shall be considered (interrupt latency of equal and lower priority interrupts increases). Protection against concurrent accesses from different interrupt handlers and/or tasks shall be assured by the user.</p>
<h1><a class="anchor" id="CRCEx"></a>
CRC Driver Examples</h1>
<h2>Simple examples</h2>
<p>Simple example with default CRC-16/CCIT-FALSE protocol </p><div class="fragment"><div class="line"><a class="code" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a> config;</div><div class="line">CRC_Type *base;</div><div class="line">uint8_t data[] = {0x00, 0x01, 0x02, 0x03, 0x04};</div><div class="line">uint16_t checksum;</div><div class="line">    </div><div class="line">base = CRC0;</div><div class="line"><a class="code" href="group__crc__driver.html#gab681cd7c82fbafd927d6b22f23a81804">CRC_GetDefaultConfig</a>(base, &amp;config); <span class="comment">/* default gives CRC-16/CCIT-FALSE */</span></div><div class="line"><a class="code" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832">CRC_Init</a>(base, &amp;config);    </div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, data, <span class="keyword">sizeof</span>(data));</div><div class="line">checksum = <a class="code" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f">CRC_Get16bitResult</a>(base);</div></div><!-- fragment --><p>Simple example with CRC-32 protocol configuration </p><div class="fragment"><div class="line"><a class="code" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a> config;</div><div class="line">uint32_t checksum;</div><div class="line"></div><div class="line">config.<a class="code" href="group__crc__driver.html#abbaed4d7eae04f71f20739687944763c">polynomial</a> = 0x04C11DB7u;</div><div class="line">config.<a class="code" href="group__crc__driver.html#a7a3a89c2bc797e681ec9d4867aa39a5f">seed</a> = 0xFFFFFFFFu;</div><div class="line">config.<a class="code" href="group__crc__driver.html#acffaf076daa11ee17d7cc204f18d6a77">crcBits</a> = <a class="code" href="group__crc__driver.html#gga27bb6a5dfedbecde067e8312600acc48ae8b84560a29f3070992ffde7d45eabeb">kCrcBits32</a>;    </div><div class="line">config.<a class="code" href="group__crc__driver.html#aa75a9a9965d31822e8eaeb03a37b50b1">reflectIn</a> = <span class="keyword">true</span>;</div><div class="line">config.<a class="code" href="group__crc__driver.html#a2334bbdf7a33c20a3e6ed0aa3ab6c87c">reflectOut</a> = <span class="keyword">true</span>;</div><div class="line">config.<a class="code" href="group__crc__driver.html#a6bef1e681e506d1a6f70fde74cf1c0fd">complementChecksum</a> = <span class="keyword">true</span>;</div><div class="line">config.<a class="code" href="group__crc__driver.html#ac2234228dcf1f82b80629b706e495cc1">crcResult</a> = kCrcFinalChecksum;</div><div class="line"></div><div class="line"><a class="code" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832">CRC_Init</a>(base, &amp;config);</div><div class="line"><span class="comment">/* example: update by 1 byte at time */</span></div><div class="line"><span class="keywordflow">while</span> (dataSize)</div><div class="line">{</div><div class="line">    uint8_t c = GetCharacter();</div><div class="line">    <a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, &amp;c, 1);</div><div class="line">    dataSize--;</div><div class="line">}        </div><div class="line">checksum = <a class="code" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f">CRC_Get32bitResult</a>(base);</div></div><!-- fragment --><h2>Advanced examples</h2>
<p>Per-partes data updates with context switch between. Assuming we have 3 tasks/threads, each using CRC module to compute checksums of different protocol, with context switches.</p>
<p>Firstly, we prepare 3 CRC module init functions for 3 different protocols: CRC-16 (ARC), CRC-16/CCIT-FALSE and CRC-32. Table below lists the individual protocol specifications. See also: <a href="http://reveng.sourceforge.net/crc-catalogue/">http://reveng.sourceforge.net/crc-catalogue/</a></p>
<table class="doxtable">
<tr>
<th></th><th>CRC-16/CCIT-FALSE </th><th>CRC-16 </th><th>CRC-32  </th></tr>
<tr>
<td><b>Width</b> </td><td>16 bits </td><td>16 bits </td><td>32 bits  </td></tr>
<tr>
<td><b>Polynomial</b> </td><td>0x1021 </td><td>0x8005 </td><td>0x04C11DB7  </td></tr>
<tr>
<td><b>Initial seed</b> </td><td>0xFFFF </td><td>0x0000 </td><td>0xFFFFFFFF  </td></tr>
<tr>
<td><b>Complement checksum</b> </td><td>No </td><td>No </td><td>Yes  </td></tr>
<tr>
<td><b>Reflect In</b> </td><td>No </td><td>Yes </td><td>Yes  </td></tr>
<tr>
<td><b>Reflect Out</b> </td><td>No </td><td>Yes </td><td>Yes  </td></tr>
</table>
<p>Corresponding init functions:</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> InitCrc16_CCIT(CRC_Type *base, uint32_t seed, <span class="keywordtype">bool</span> isLast)</div><div class="line">{</div><div class="line">    <a class="code" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a> config;</div><div class="line">            </div><div class="line">    config.<a class="code" href="group__crc__driver.html#abbaed4d7eae04f71f20739687944763c">polynomial</a> = 0x1021;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#a7a3a89c2bc797e681ec9d4867aa39a5f">seed</a> = seed;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#aa75a9a9965d31822e8eaeb03a37b50b1">reflectIn</a> = <span class="keyword">false</span>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#a2334bbdf7a33c20a3e6ed0aa3ab6c87c">reflectOut</a> = <span class="keyword">false</span>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#a6bef1e681e506d1a6f70fde74cf1c0fd">complementChecksum</a> = <span class="keyword">false</span>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#acffaf076daa11ee17d7cc204f18d6a77">crcBits</a> = kCrcBits16;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#ac2234228dcf1f82b80629b706e495cc1">crcResult</a> = isLast?kCrcFinalChecksum:<a class="code" href="group__crc__driver.html#ggab245947cd140d75c90d2e185f3ae22f5ad008037099aa6038d87976c8c29bf489">kCrcIntermediateChecksum</a>;</div><div class="line">    </div><div class="line">    <a class="code" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832">CRC_Init</a>(base, &amp;config);</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> InitCrc16(CRC_Type *base, uint32_t seed, <span class="keywordtype">bool</span> isLast)</div><div class="line">{</div><div class="line">    <a class="code" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a> config;</div><div class="line">            </div><div class="line">    config.<a class="code" href="group__crc__driver.html#abbaed4d7eae04f71f20739687944763c">polynomial</a> = 0x8005;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#a7a3a89c2bc797e681ec9d4867aa39a5f">seed</a> = seed;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#aa75a9a9965d31822e8eaeb03a37b50b1">reflectIn</a> = <span class="keyword">true</span>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#a2334bbdf7a33c20a3e6ed0aa3ab6c87c">reflectOut</a> = <span class="keyword">true</span>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#a6bef1e681e506d1a6f70fde74cf1c0fd">complementChecksum</a> = <span class="keyword">false</span>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#acffaf076daa11ee17d7cc204f18d6a77">crcBits</a> = kCrcBits16;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#ac2234228dcf1f82b80629b706e495cc1">crcResult</a> = isLast?kCrcFinalChecksum:<a class="code" href="group__crc__driver.html#ggab245947cd140d75c90d2e185f3ae22f5ad008037099aa6038d87976c8c29bf489">kCrcIntermediateChecksum</a>;</div><div class="line">    </div><div class="line">    <a class="code" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832">CRC_Init</a>(base, &amp;config);    </div><div class="line">}</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> InitCrc32(CRC_Type *base, uint32_t seed, <span class="keywordtype">bool</span> isLast)</div><div class="line">{</div><div class="line">    <a class="code" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a> config;</div><div class="line">    </div><div class="line">    config.<a class="code" href="group__crc__driver.html#abbaed4d7eae04f71f20739687944763c">polynomial</a> = 0x04C11DB7U;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#a7a3a89c2bc797e681ec9d4867aa39a5f">seed</a> = seed;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#aa75a9a9965d31822e8eaeb03a37b50b1">reflectIn</a> = <span class="keyword">true</span>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#a2334bbdf7a33c20a3e6ed0aa3ab6c87c">reflectOut</a> = <span class="keyword">true</span>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#a6bef1e681e506d1a6f70fde74cf1c0fd">complementChecksum</a> = <span class="keyword">true</span>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#acffaf076daa11ee17d7cc204f18d6a77">crcBits</a> = <a class="code" href="group__crc__driver.html#gga27bb6a5dfedbecde067e8312600acc48ae8b84560a29f3070992ffde7d45eabeb">kCrcBits32</a>;</div><div class="line">    config.<a class="code" href="group__crc__driver.html#ac2234228dcf1f82b80629b706e495cc1">crcResult</a> = isLast?kCrcFinalChecksum:<a class="code" href="group__crc__driver.html#ggab245947cd140d75c90d2e185f3ae22f5ad008037099aa6038d87976c8c29bf489">kCrcIntermediateChecksum</a>;</div><div class="line">    </div><div class="line">    <a class="code" href="group__crc__driver.html#ga7114311534a33b6688f35ceaaa3f7832">CRC_Init</a>(base, &amp;config);    </div><div class="line">}</div></div><!-- fragment --><p>The following context switches show possible API usage:</p>
<div class="fragment"><div class="line">uint16_t checksumCrc16;</div><div class="line">uint32_t checksumCrc32;</div><div class="line">uint16_t checksumCrc16Ccit;</div><div class="line"></div><div class="line">checksumCrc16 = 0x0;</div><div class="line">checksumCrc32 = 0xFFFFFFFFU;</div><div class="line">checksumCrc16Ccit = 0xFFFFU;</div><div class="line"></div><div class="line"><span class="comment">/* Task A bytes[0-3] */</span></div><div class="line">InitCrc16(base, checksumCrc16, <span class="keyword">false</span>);</div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, &amp;data[0], 4);</div><div class="line">checksumCrc16 = <a class="code" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f">CRC_Get16bitResult</a>(base);</div><div class="line"></div><div class="line"><span class="comment">/* Task B bytes[0-3] */</span></div><div class="line">InitCrc16_CCIT(base, checksumCrc16Ccit, <span class="keyword">false</span>);</div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, &amp;data[0], 4);</div><div class="line">checksumCrc16Ccit = <a class="code" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f">CRC_Get16bitResult</a>(base);</div><div class="line"></div><div class="line"><span class="comment">/* Task C 4 bytes[0-3] */</span></div><div class="line">InitCrc32(base, checksumCrc32, <span class="keyword">false</span>);</div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, &amp;data[0], 4);</div><div class="line">checksumCrc32 = <a class="code" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f">CRC_Get32bitResult</a>(base);</div><div class="line"></div><div class="line"><span class="comment">/* Task B add final 5 bytes[4-8] */</span></div><div class="line">InitCrc16_CCIT(base, checksumCrc16Ccit, <span class="keyword">true</span>);</div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, &amp;data[4], 5);</div><div class="line">checksumCrc16Ccit = <a class="code" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f">CRC_Get16bitResult</a>(base);</div><div class="line"></div><div class="line"><span class="comment">/* Task C 3 bytes[4-6] */</span></div><div class="line">InitCrc32(base, checksumCrc32, <span class="keyword">false</span>);</div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, &amp;data[4], 3);</div><div class="line">checksumCrc32 = <a class="code" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f">CRC_Get32bitResult</a>(base);</div><div class="line"></div><div class="line"><span class="comment">/* Task A 3 bytes[4-6] */</span></div><div class="line">InitCrc16(base, checksumCrc16, <span class="keyword">false</span>);</div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, &amp;data[4], 3);</div><div class="line">checksumCrc16 = <a class="code" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f">CRC_Get16bitResult</a>(base);</div><div class="line"></div><div class="line"><span class="comment">/* Task C add final 2 bytes[7-8] */</span></div><div class="line">InitCrc32(base, checksumCrc32, <span class="keyword">true</span>);</div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, &amp;data[7], 2);</div><div class="line">checksumCrc32 = <a class="code" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f">CRC_Get32bitResult</a>(base);</div><div class="line"></div><div class="line"><span class="comment">/* Task A add final 2 bytes[7-8] */</span></div><div class="line">InitCrc16(base, checksumCrc16, <span class="keyword">true</span>);</div><div class="line"><a class="code" href="group__crc__driver.html#ga33f99b0cb581e677dbc009a695adf5d5">CRC_WriteData</a>(base, &amp;data[7], 2);</div><div class="line">checksumCrc16 = <a class="code" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f">CRC_Get16bitResult</a>(base);</div></div><!-- fragment --> <hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structcrc__config__t" id="structcrc__config__t"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct crc_config_t</td>
        </tr>
      </table>
</div><div class="memdoc">
<div class="textblock"><p>CRC protocol configuration. </p>
<p>This structure holds the configuration for the CRC protocol. </p>
</div><table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a6bef1e681e506d1a6f70fde74cf1c0fd"></a>bool</td>
<td class="fieldname">
complementChecksum</td>
<td class="fielddoc">
<p>True if the result shall be complement of the actual checksum. </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="acffaf076daa11ee17d7cc204f18d6a77"></a><a class="el" href="group__crc__driver.html#ga27bb6a5dfedbecde067e8312600acc48">crc_bits_t</a></td>
<td class="fieldname">
crcBits</td>
<td class="fielddoc">
<p>Selects 16- or 32- bit CRC protocol. </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="ac2234228dcf1f82b80629b706e495cc1"></a><a class="el" href="group__crc__driver.html#gab245947cd140d75c90d2e185f3ae22f5">crc_result_t</a></td>
<td class="fieldname">
crcResult</td>
<td class="fielddoc">
<p>Selects final or intermediate checksum return from <a class="el" href="group__crc__driver.html#ga446972c25252d95d42f573553d32091f" title="Read 16-bit checksum from the CRC module. ">CRC_Get16bitResult()</a> or <a class="el" href="group__crc__driver.html#ga0c8ce306124e645b27798fad68f3ac4f" title="Read 32-bit checksum from the CRC module. ">CRC_Get32bitResult()</a> </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="abbaed4d7eae04f71f20739687944763c"></a>uint32_t</td>
<td class="fieldname">
polynomial</td>
<td class="fielddoc">
<p>CRC Polynomial, MSBit first. Example polynomial: 0x1021 = 1_0000_0010_0001 = x^12+x^5+1 </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="aa75a9a9965d31822e8eaeb03a37b50b1"></a>bool</td>
<td class="fieldname">
reflectIn</td>
<td class="fielddoc">
<p>Reflect bits on input. </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a2334bbdf7a33c20a3e6ed0aa3ab6c87c"></a>bool</td>
<td class="fieldname">
reflectOut</td>
<td class="fielddoc">
<p>Reflect bits on output. </p>
</td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a7a3a89c2bc797e681ec9d4867aa39a5f"></a>uint32_t</td>
<td class="fieldname">
seed</td>
<td class="fielddoc">
<p>Starting checksum value </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="ga27bb6a5dfedbecde067e8312600acc48"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__crc__driver.html#ga27bb6a5dfedbecde067e8312600acc48">crc_bits_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>CRC bit width. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="gga27bb6a5dfedbecde067e8312600acc48ae8b84560a29f3070992ffde7d45eabeb"></a>kCrcBits32&#160;</td><td class="fielddoc">
<p>Generate 16-bit CRC code </p>
</td></tr>
</table>

</div>
</div>
<a class="anchor" id="gab245947cd140d75c90d2e185f3ae22f5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__crc__driver.html#gab245947cd140d75c90d2e185f3ae22f5">crc_result_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>CRC result type. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="ggab245947cd140d75c90d2e185f3ae22f5ad008037099aa6038d87976c8c29bf489"></a>kCrcIntermediateChecksum&#160;</td><td class="fielddoc">
<p>CRC data register read value is the final checksum. Reflect out and final xor protocol features are applied. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga7a4d725b011a98efb29a26bcca04c35b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void CRC_Deinit </td>
          <td>(</td>
          <td class="paramtype">CRC_Type *&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Disable the CRC peripheral module. </p>
<p>This functions disables the clock gate in the Kinetis SIM module for the CRC peripheral.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>CRC peripheral address. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga446972c25252d95d42f573553d32091f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t CRC_Get16bitResult </td>
          <td>(</td>
          <td class="paramtype">CRC_Type *&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Read 16-bit checksum from the CRC module. </p>
<p>Reads CRC data register (intermediate or final checksum). The configured type of transpose and complement are applied.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>CRC peripheral address. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>intermediate or final 16-bit checksum, after configured transpose and complement operations. </dd></dl>

</div>
</div>
<a class="anchor" id="ga0c8ce306124e645b27798fad68f3ac4f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint32_t CRC_Get32bitResult </td>
          <td>(</td>
          <td class="paramtype">CRC_Type *&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Read 32-bit checksum from the CRC module. </p>
<p>Reads CRC data register (intermediate or final checksum). The configured type of transpose and complement are applied.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>CRC peripheral address. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>intermediate or final 32-bit checksum, after configured transpose and complement operations. </dd></dl>

</div>
</div>
<a class="anchor" id="gab681cd7c82fbafd927d6b22f23a81804"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CRC_GetDefaultConfig </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a> *&#160;</td>
          <td class="paramname"><em>config</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Loads default values to CRC protocol configuration structure. </p>
<p>Loads default values to CRC protocol configuration structure. The default values are: </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;config-&gt;polynomial = 0x1021;</div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;config-&gt;seed = 0xFFFF;</div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;config-&gt;reflectIn = false;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;config-&gt;reflectOut = false;</div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;config-&gt;complementChecksum = false;</div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;config-&gt;crcBits = kCrcBits16;</div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;config-&gt;crcResult = kCrcFinalChecksum;</div></div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">config</td><td>CRC protocol configuration structure </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga7114311534a33b6688f35ceaaa3f7832"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CRC_Init </td>
          <td>(</td>
          <td class="paramtype">CRC_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__crc__driver.html#structcrc__config__t">crc_config_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enable and configure the CRC peripheral module. </p>
<p>This functions enables the clock gate in the Kinetis SIM module for the CRC peripheral. It also configures the CRC module and starts checksum computation by writing the seed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>CRC peripheral address. </td></tr>
    <tr><td class="paramname">config</td><td>CRC module configuration structure </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga33f99b0cb581e677dbc009a695adf5d5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CRC_WriteData </td>
          <td>(</td>
          <td class="paramtype">CRC_Type *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>dataSize</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Write data to the CRC module. </p>
<p>Writes input data buffer bytes to CRC data register. The configured type of transpose is applied.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>CRC peripheral address. </td></tr>
    <tr><td class="paramname">data</td><td>Input data stream, MSByte in data[0]. </td></tr>
    <tr><td class="paramname">dataSize</td><td>Size in bytes of the input data buffer. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Mar 7 2016 16:48:23 for Kinetis Bootloader by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
